// pages/discovery/components/comment/comment.js
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    showReplay:{
      type: Boolean,
      value: false
    },
    comment: {
      type: Object,
      value: {}
    },
    parentId:{
      type: Number,
      value: ''   
    }
  },
  observers: {
    'showReplay': function(showReplay) {
      this.setData({
        showReplayPanel: showReplay,
        lastShowReplayPanel:this.data.showReplayPanel
      })
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    APP_OSSURL_API: app.APP_OSSURL_API,
    showReplayPanel: false,
    lastShowReplayPanel:false,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    showReplay: function (e) {
      this.setData({
        showReplayPanel: !this.data.lastShowReplayPanel
      })
    },
    replay: function (e) {

      this.triggerEvent("replay", { 
        nickname: e.currentTarget.dataset.nickname ,        
        forReviewId: e.currentTarget.dataset.id ,
        parentId:this.data.parentId
      })
    }
  }
})
